home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource5
/
352_01
/
read.me
< prev
next >
Wrap
Text File
|
1991-06-08
|
3KB
|
70 lines
READ.ME - introduction to some C++ code submited to the CUG.
This disk contains DBLIB.H and VECTOR.H, written for TURBO C++
DBLIB.H -
There are 2 main classes defined here, plus some
miscellaneous routines that may be considered to be
'extensions' to the WTWG windows package. WTWG is available
through the C user's group.
class String {...} provides BASIC-like string processing for
C++ programs. see the demo program STRDEMO.CPP on this disk.
class Vlist {...} provides a flexible array of pointers to
data objects. The usefullness of this class can be seen in
the routines wildfile() and wildfile_pick() which are in the
files wildfile.cpp and wildpick.cpp, or in the demo program
subdir (which is in subdir.cpp).
miscellaneous functions using the above classes are included,
such as wildfile() and wildfile_pick() which handle directory
listings for WTWG windows programs, make_fullfilename() which
concatenates and validates the parts of a DOS filename, and
some WFORM validation routines for use with the WTWG
wscanform() routine.
VECTOR.H -
This defines a class Vector {...} which is a glorified array
of floats. Vector arithmetic, inner products, norms, etc are
supported. There is also class CVector {...} which provides
for arrays of complex numbers. Note that CVector stores all
the real parts together and all the imaginary parts together,
which is more usefull for graphing results, etc than storing
alternating real/imag.
NOTES ON USE OF THESE CLASSES:
1) both classes use the WTWG library for memory
allocation. You can override the calls to wmalloc() and
to wrealloc() as shown in the demo program subdir.cpp, so
you can use these classes without using WTWG if you like.
2) You can derive a fixed length version of Vlist (ie: to
store fixed length data structures instead of variable
length strings) if you provide your own versions of the
virtual functions Vlist::copy() and Vlist::compare().
Also, you can further derive other list managers for any
other C++ classes you should make up, so Vlist provides a
dynamically allocated array of any type of object. This
is a good way to learn C++ and it's easy, so I left it
for you.
3) member functions that return newly created objects
return pointers to the objects, which must be explicitly
deleted (see strdemo.cpp for example of
String::tokenize()). Although this is less elegant and
more error-prone than passing back the actual newly
created object, it is VASTLY more efficient.
4) These classes are my first real use of C++. Those of you
who are more experienced C++ programmers might find much to
complain about, and if so I would like to hear from you. I
can be reached by regular mail:
David Blum
8039 North 1st Street
Phoeniz, Arizona 85020